package com.hbyj.object;

import com.hbyj.db.function.DbTools;
import com.hbyj.hbm.vo.DepartmentCategory;
import com.hbyj.hbm.vo.Departments;

public class DepartmentForFlexGrid {
	private Integer id;
	private String department_name;
	private String department_category;
	private String department_remarks;
	private String department_regionCode;
	
	public DepartmentForFlexGrid(Departments departments){
		this.InitObjectByHibernateClass(departments);
	}
	
	public DepartmentForFlexGrid(){
		
	}
	
	public Departments GetHiberObject(){
		Departments hiberObjDepartments = new Departments();
		hiberObjDepartments.setId(this.id);
		hiberObjDepartments.setName(this.department_name);
		hiberObjDepartments.setRemarks(this.department_remarks);
		hiberObjDepartments.setRegionCode(this.department_regionCode);
//		DepartmentCategory dpcCategory = (DepartmentCategory)DbTools.findByHql("from DepartmentCategory dc where dc.name='"+this.department_category+"'").get(0);
//		hiberObjDepartments.setDepartmentCategory(dpcCategory);
		return hiberObjDepartments;
	}
	
	private void InitObjectByHibernateClass(Departments departments){
		this.id = departments.getId();
		this.department_name = departments.getName();
		//this.department_category = departments.getDepartmentCategory().getName();
		this.department_regionCode = departments.getRegionCode();
		this.department_remarks = departments.getRemarks();
	}
	
	public void setDepartment_name(String department_name) {
		this.department_name = department_name;
	}
	public String getDepartment_name() {
		return department_name;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public Integer getId() {
		return id;
	}
	public void setDepartment_category(String department_category) {
		this.department_category = department_category;
	}
	public String getDepartment_category() {
		return department_category;
	}
	public void setDepartment_remarks(String department_remarks) {
		this.department_remarks = department_remarks;
	}
	public String getDepartment_remarks() {
		return department_remarks;
	}

	public void setDepartment_regionCode(String department_regionCode) {
		this.department_regionCode = department_regionCode;
	}

	public String getDepartment_regionCode() {
		return department_regionCode;
	}
}
